<template>
  <view>
    <view v-for="(item, index) in datalist" :key="index" style="margin: 10rpx;">
      <cardViewText
        :nID="item.nID"
        :title="item.title"
        :isTop="item.isTop"
        :author="item.author"
        :comments="item.comments"
        :time="item.time"
      >
        <template v-slot:header v-if="item.isTop">
          <image style="width: 28rpx; height: 28rpx; margin-bottom: 8rpx;"></image>
        </template>
        <template v-slot:tips v-if="item.showSearch">
          <view class="slotcontent" style="margin-top: 12rpx; padding-top: 12rpx; border-top: 1rpx solid #f0f0f0;">
            <text style="font-size: 24rpx; color: mediumpurple;">搜索:</text>
            <view style="display: inline-block; margin-left: 12rpx;">
              <view class="borderbox" style="display: inline-block; padding: 4rpx 16rpx; border: 1rpx solid mediumpurple; border-radius: 16rpx; margin-right: 12rpx; margin-top: 8rpx;">
                <text style="font-size: 22rpx; color: mediumpurple;">{{ item.searchTags[0] }}</text>
              </view>
              <view class="borderbox" style="display: inline-block; padding: 4rpx 16rpx; border: 1rpx solid mediumpurple; border-radius: 16rpx; margin-right: 12rpx; margin-top: 8rpx;">
                <text style="font-size: 22rpx; color: mediumpurple;">{{ item.searchTags[1] }}</text>
              </view>
            </view>
          </view>
        </template>
      </cardViewText>
    </view>
  </view>
</template>

<script>
import cardViewText from "../../components/cardViewText.vue";
export default{
  components:{
    cardViewText
  },
  data(){
    return{
      datalist:[
        {
          nID:"T15627",
          title:"14个月从100家开到1000家门店，蜜雪冰城为何买下这家精酿啤酒商",
          isTop:true,
          author:"界面新闻",
          comments:56,
          time:"2025.10.07",
          showSearch:false,
          searchTags:[]
        },
        {
          nID:"B4485",
          title:"把握历史大势 共创美好未来（观沧海）",
          isTop:false,
          author:"人民日报",
          comments:1025,
          time:"2025.10.25",
          searchTags:[]
        },
        {
          nID:"G7892",
          title:"黄金还能走多远？卖方高呼“第三浪启动”，230多份研报看多",
          isTop:false,
          author:"财联社",
          comments:452,
          time:"2025.10.08",
          showSearch:true,
          searchTags:["今日金价","精选好物"]
        },
        {
          nID:"J3456",
          title:"“没有短板”的完美战鹰！歼-16机库独家探访",
          isTop:false,
          author:"红星新闻",
          comments:56,
          time: "2025.10.07",
          showSearch:false,
          searchTags:[]
        },
		{
		  nID:"U1232",
		  title:"多国学者共探巴克特里亚考古 携手推进丝绸之路文明研究新进程",
		  isTop:false,
		  author:"中国日报网",
		  comments:56,
		  time:"2025.10.12",
		  showSearch:false,
		  searchTags:[]
		}
      ]
    };
  }
};
</script>

<style>
page {
  background-color: white;
  padding: 10rpx;
}
</style>